home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!snorkelwacker!apple!sun-barr!newstop!sun!harvard.harvard.edu!jimf%saber
- From: jimf%saber@harvard.harvard.edu
- Newsgroups: comp.sources.x
- Subject: REPOST: v06i057: xloadimage, Patch4
- Message-ID: <133718@sun.Eng.Sun.COM>
- Date: 30 Mar 90 18:02:08 GMT
- Sender: news@sun.Eng.Sun.COM
- Lines: 543
- Approved: argv@sun.com
-
- Submitted-by: jimf%saber@harvard.harvard.edu
- Posting-number: Volume 6, Issue 57
- Archive-name: xldimage/patch4
- Patch-To: xldimage: Volume 5, Issues 27,28,30
- Patch-To: xldimage: Volume 6, Issues 1,2
-
- [ Reposted because I forgot to put the Patch-To: headers in... --dan ]
-
- Following this message is a patch file to bring xloadimage patchlevel
- 03 up to patchlevel 04.
-
- There are no new image formats in this patchlevel, but a number of
- bugs are fixed:
-
- * -quiet and -zoom now work in conjunction
- * -border now works on monochrome displays
- * -onroot calls now try to clean up after previous loads
- * several calls to XCreateColormap were missing a parameter
- * the Imakefile and Makefiles are slightly better
- * an allocation error in newBitImage has been corrected
-
- If you don't have patchlevel 03, it is available via anonymous ftp
- from expo.lcs.mit.edu in /contrib/xloadimage.1.03.tar.Z. This patch
- is also available in /contrib/xloadimage.1.04.patch.Z.
-
- Enjoy,
-
- jim frost
- saber software
- jimf@saber.com
-
- -- patch.04: cut here --
- diff -c xloadimage.03/Imakefile xloadimage.04/Imakefile
- *** xloadimage.03/Imakefile Wed Dec 13 15:18:47 1989
- --- xloadimage.04/Imakefile Fri Mar 2 19:02:00 1990
- ***************
- *** 1,6 ****
- ! SYSPATHFILE = $(USRLIBDIR)/xloadimagerc
- DEFINES = -DSYSPATHFILE=\"$(SYSPATHFILE)\"
- ! DEPLIBS = $(DEPLIBS)
- LOCAL_LIBRARIES = $(XLIB)
- SRCS = bright.c clip.c compress.c dither.c faces.c fill.c \
- gif.c halftone.c imagetypes.c merge.c misc.c new.c \
- --- 1,6 ----
- ! SYSPATHFILE = $(XAPPLOADDIR)/Xloadimage
- DEFINES = -DSYSPATHFILE=\"$(SYSPATHFILE)\"
- ! DEPLIBS = $(DEPXLIB)
- LOCAL_LIBRARIES = $(XLIB)
- SRCS = bright.c clip.c compress.c dither.c faces.c fill.c \
- gif.c halftone.c imagetypes.c merge.c misc.c new.c \
- ***************
- *** 14,16 ****
- --- 14,33 ----
- xpixmap.o zio.o zoom.o
-
- ComplexProgramTarget(xloadimage)
- +
- + install:: $(SYSPATHFILE)
- + $(RM) $(BINDIR)/xview $(BINDIR)/xsetbg
- + $(LN) $(BINDIR)/xloadimage $(BINDIR)/xview
- + $(LN) $(BINDIR)/xloadimage $(BINDIR)/xsetbg
- +
- + $(SYSPATHFILE):
- + @echo "*** Creating default $(SYSPATHFILE) since you"
- + @echo "*** don't have one. This file is used to set up default places"
- + @echo "*** and names to look for images. You probably want to edit"
- + @echo "*** it for your site. See the xloadimage manual page for"
- + @echo "*** details on the contents of this file."
- + cp /dev/null $(SYSPATHFILE)
- + echo "path=$(LIBDIR)/bitmaps $(LIBDIR)/images" \
- + >> $(SYSPATHFILE)
- + echo "extension=.csun .msun .sun .face .xbm .bm .gif" \
- + >>$(SYSPATHFILE)
- diff -c xloadimage.03/Makefile.gcc xloadimage.04/Makefile.gcc
- *** xloadimage.03/Makefile.gcc Wed Jan 3 15:30:20 1990
- --- xloadimage.04/Makefile.gcc Fri Mar 2 19:02:00 1990
- ***************
- *** 4,11 ****
- #
- # See file "copyright.h" for complete copyright information.
-
- CC= gcc
- ! CFLAGS= -O -fstrength-reduce -finline-functions -DSYSPATHFILE=\"/usr/lib/xloadimagerc\"
-
- LIBS= -lX11
- OBJS= bright.o clip.o compress.o dither.o faces.o fill.o gif.o \
- --- 4,16 ----
- #
- # See file "copyright.h" for complete copyright information.
-
- + SYSPATHFILE=/usr/lib/X11/Xloadimage
- + INSTALLDIR=/usr/bin/X11
- CC= gcc
- ! CFLAGS= -O -fstrength-reduce -finline-functions -DSYSPATHFILE=\"$(SYSPATHFILE)\"
- ! CP= cp
- ! LN= ln -s
- ! RM= rm -f
-
- LIBS= -lX11
- OBJS= bright.o clip.o compress.o dither.o faces.o fill.o gif.o \
- ***************
- *** 16,23 ****
- --- 21,48 ----
- xloadimage: $(OBJS)
- $(CC) $(CFLAGS) -o xloadimage $(OBJS) $(LIBS)
-
- + install: $(SYSPATHFILE)
- + $(RM) $(INSTALLDIR)/xloadimage
- + $(RM) $(INSTALLDIR)/xsetbg
- + $(RM) $(INSTALLDIR)/xview
- + $(CP) xloadimage $(INSTALLDIR)/xloadimage
- + $(LN) $(INSTALLDIR)/xloadimage $(INSTALLDIR)/xsetbg
- + $(LN) $(INSTALLDIR)/xloadimage $(INSTALLDIR)/xview
- +
- clean:
- rm -f *.o *~ xloadimage
-
- .c.o: xloadimage.h
- $(CC) -c $(CFLAGS) $*.c
- +
- + $(SYSPATHFILE):
- + @echo "*** Creating default $(SYSPATHFILE) since you"
- + @echo "*** don't have one. This file is used to set up default places"
- + @echo "*** and names to look for images. You probably want to edit"
- + @echo "*** it for your site. See the xloadimage manual page for"
- + @echo "*** details on the contents of this file."
- + cp /dev/null $(SYSPATHFILE)
- + echo "path= /usr/local/images" \
- + >> $(SYSPATHFILE)
- + echo "extension=.csun .msun .sun .face .xbm .bm .gif" \
- + >>$(SYSPATHFILE)
- diff -c xloadimage.03/Makefile.std xloadimage.04/Makefile.std
- *** xloadimage.03/Makefile.std Wed Jan 3 15:30:10 1990
- --- xloadimage.04/Makefile.std Fri Mar 2 19:02:00 1990
- ***************
- *** 4,11 ****
- #
- # See file "copyright.h" for complete copyright information.
-
- CC= cc
- ! CFLAGS= -O -DSYSPATHFILE=\"/usr/lib/xloadimagerc\"
-
- LIBS= -lX11
- OBJS= bright.o clip.o compress.o dither.o faces.o fill.o gif.o \
- --- 4,16 ----
- #
- # See file "copyright.h" for complete copyright information.
-
- + SYSPATHFILE=/usr/lib/X11/Xloadimage
- + INSTALLDIR=/usr/bin/X11
- CC= cc
- ! CFLAGS= -O -DSYSPATHFILE=\"$(SYSPATHFILE)\"
- ! CP= cp
- ! LN= ln -s
- ! RM= rm -f
-
- LIBS= -lX11
- OBJS= bright.o clip.o compress.o dither.o faces.o fill.o gif.o \
- ***************
- *** 16,23 ****
- --- 21,48 ----
- xloadimage: $(OBJS)
- $(CC) $(CFLAGS) -o xloadimage $(OBJS) $(LIBS)
-
- + install: $(SYSPATHFILE)
- + $(RM) $(INSTALLDIR)/xloadimage
- + $(RM) $(INSTALLDIR)/xsetbg
- + $(RM) $(INSTALLDIR)/xview
- + $(CP) xloadimage $(INSTALLDIR)/xloadimage
- + $(LN) $(INSTALLDIR)/xloadimage $(INSTALLDIR)/xsetbg
- + $(LN) $(INSTALLDIR)/xloadimage $(INSTALLDIR)/xview
- +
- clean:
- rm -f *.o *~ xloadimage
-
- .c.o: xloadimage.h
- $(CC) -c $(CFLAGS) $*.c
- +
- + $(SYSPATHFILE):
- + @echo "*** Creating default $(SYSPATHFILE) since you"
- + @echo "*** don't have one. This file is used to set up default places"
- + @echo "*** and names to look for images. You probably want to edit"
- + @echo "*** it for your site. See the xloadimage manual page for"
- + @echo "*** details on the contents of this file."
- + cp /dev/null $(SYSPATHFILE)
- + echo "path= /usr/local/images" \
- + >> $(SYSPATHFILE)
- + echo "extension=.csun .msun .sun .face .xbm .bm .gif" \
- + >>$(SYSPATHFILE)
- diff -c xloadimage.03/README xloadimage.04/README
- *** xloadimage.03/README Wed Jan 3 12:41:10 1990
- --- xloadimage.04/README Fri Mar 2 19:02:01 1990
- ***************
- *** 130,132 ****
- --- 130,142 ----
- are not a multiple of 8. Window.c was modified to avoid deleting the
- default colormap, allowing proper operation on some servers prior to
- X11R3 patchlevel 08. There were many miscellaneous bug fixes.
- +
- + Patchlevel 04 contained an enhancement to root.c to use
- + RetainTemporary and KillClient(disp, AllTemporary) so that it could
- + clean up after itself when reloading. The -quiet and -zoom options no
- + longer cause garbage to be displayed for the image title. A small bug
- + in new.c that caused incorrect allocation of bitmap images was fixed.
- + Several calls to XCreateColormap were missing the "visual" parameter
- + in send.c; this was fixed. A bug relating to -border and monochrome
- + displays was fixed. There were several changes to the Imakefile and
- + Makefiles.
- diff -c xloadimage.03/new.c xloadimage.04/new.c
- *** xloadimage.03/new.c Wed Dec 6 14:56:08 1989
- --- xloadimage.04/new.c Fri Mar 2 19:02:06 1990
- ***************
- *** 56,64 ****
- image->width= width;
- image->height= height;
- image->depth= 1;
- ! linelen= width / 8;
- ! if (linelen % 8)
- ! linelen++;
- image->data= (unsigned char *)lcalloc(linelen * height);
- return(image);
- }
- --- 56,62 ----
- image->width= width;
- image->height= height;
- image->depth= 1;
- ! linelen= (width / 8) + (width % 8 ? 1 : 0); /* thanx johnh@amcc.com */
- image->data= (unsigned char *)lcalloc(linelen * height);
- return(image);
- }
- diff -c xloadimage.03/patchlevel xloadimage.04/patchlevel
- *** xloadimage.03/patchlevel Wed Jan 3 14:37:02 1990
- --- xloadimage.04/patchlevel Fri Mar 2 19:02:06 1990
- ***************
- *** 2,5 ****
- */
-
- #define VERSION "1"
- ! #define PATCHLEVEL "03"
- --- 2,5 ----
- */
-
- #define VERSION "1"
- ! #define PATCHLEVEL "04"
- diff -c xloadimage.03/path.c xloadimage.04/path.c
- *** xloadimage.03/path.c Wed Jan 3 15:33:01 1990
- --- xloadimage.04/path.c Fri Mar 2 19:02:07 1990
- ***************
- *** 173,178 ****
- --- 173,179 ----
- }
- for (a= 0; a < NumPaths; a++) {
- printf("%s:\n", Paths[a]);
- + fflush(stdout);
- sprintf(buf, "ls %s", Paths[a]);
- if (system(buf) < 0) {
- perror("ls");
- diff -c xloadimage.03/root.c xloadimage.04/root.c
- *** xloadimage.03/root.c Wed Jan 3 15:34:57 1990
- --- xloadimage.04/root.c Fri Mar 2 19:02:08 1990
- ***************
- *** 11,25 ****
- #include "copyright.h"
- #include "xloadimage.h"
-
- ! void imageOnRoot(disp, scrn, image, install, verbose)
- Display *disp;
- int scrn;
- Image *image;
- - unsigned int install;
- unsigned int verbose;
- { Pixmap pixmap;
- Colormap xcmap;
-
- if (! sendImageToX(disp, scrn, DefaultVisual(disp, scrn), image,
- &pixmap, &xcmap, verbose))
- exit(1);
- --- 11,34 ----
- #include "copyright.h"
- #include "xloadimage.h"
-
- ! void imageOnRoot(disp, scrn, image, verbose)
- Display *disp;
- int scrn;
- Image *image;
- unsigned int verbose;
- { Pixmap pixmap;
- Colormap xcmap;
-
- + /* xloadimage retains its information "temporarily" so that it can clean
- + * up after itself. this is supposed to clean up those resources on a
- + * subsequent load. may effect other clients. a better way might be to
- + * create a property and save the pixmap in it, exit retainpermanent, and
- + * xkillclient the pixmap id if it exists.
- + */
- +
- + XKillClient(disp, AllTemporary); /* kill temporarily held resources; used to
- + * clean up previous "onroot" loads */
- +
- if (! sendImageToX(disp, scrn, DefaultVisual(disp, scrn), image,
- &pixmap, &xcmap, verbose))
- exit(1);
- ***************
- *** 36,40 ****
- XSetWindowBackgroundPixmap(disp, RootWindow(disp, scrn), pixmap);
- XClearWindow(disp, RootWindow(disp, scrn));
- XFreePixmap(disp, pixmap);
- ! XSetCloseDownMode(disp, RetainPermanent);
- }
- --- 45,49 ----
- XSetWindowBackgroundPixmap(disp, RootWindow(disp, scrn), pixmap);
- XClearWindow(disp, RootWindow(disp, scrn));
- XFreePixmap(disp, pixmap);
- ! XSetCloseDownMode(disp, RetainTemporary);
- }
- diff -c xloadimage.03/send.c xloadimage.04/send.c
- *** xloadimage.03/send.c Wed Jan 3 15:35:19 1990
- --- xloadimage.04/send.c Fri Mar 2 19:02:08 1990
- ***************
- *** 81,90 ****
- }
- else {
- if ((visual->class == PseudoColor) || (visual->class == GrayScale)) {
- ! *cmap= XCreateColormap(disp, RootWindow(disp, scrn), AllocNone);
- }
- else
- ! *cmap= XCreateColormap(disp, RootWindow(disp, scrn), AllocAll);
- newmap= 1;
- }
-
- --- 81,90 ----
- }
- else {
- if ((visual->class == PseudoColor) || (visual->class == GrayScale)) {
- ! *cmap= XCreateColormap(disp, RootWindow(disp, scrn), visual, AllocNone);
- }
- else
- ! *cmap= XCreateColormap(disp, RootWindow(disp, scrn), visual, AllocAll);
- newmap= 1;
- }
-
- diff -c xloadimage.03/xloadimage.c xloadimage.04/xloadimage.c
- *** xloadimage.03/xloadimage.c Wed Jan 3 15:36:19 1990
- --- xloadimage.04/xloadimage.c Fri Mar 2 19:02:10 1990
- ***************
- *** 351,356 ****
- --- 351,372 ----
- *dispimage->rgb.green= xcolor.green;
- *dispimage->rgb.blue= xcolor.blue;
- }
- +
- + /* bitmap needs both black and white
- + */
- +
- + if (DefaultDepth(disp, scrn) == 1) {
- + if (*(dispimage->rgb.red)) {
- + *(dispimage->rgb.red + 1)= 0;
- + *(dispimage->rgb.green + 1)= 0;
- + *(dispimage->rgb.blue + 1)= 0;
- + }
- + else {
- + *(dispimage->rgb.red + 1)= 65535;
- + *(dispimage->rgb.green + 1)= 65535;
- + *(dispimage->rgb.blue + 1)= 65535;
- + }
- + }
- fill(dispimage, 0, 0, winwidth, winheight, 0);
- }
-
- ***************
- *** 388,394 ****
- }
-
- if (onroot)
- ! imageOnRoot(disp, scrn, dispimage, install, verbose);
- else
- imageInWindow(disp, scrn, dispimage, winx, winy, winwidth, winheight,
- install, verbose);
- --- 404,410 ----
- }
-
- if (onroot)
- ! imageOnRoot(disp, scrn, dispimage, verbose);
- else
- imageInWindow(disp, scrn, dispimage, winx, winy, winwidth, winheight,
- install, verbose);
- diff -c xloadimage.03/xloadimage.man xloadimage.04/xloadimage.man
- *** xloadimage.03/xloadimage.man Wed Jan 3 15:51:00 1990
- --- xloadimage.04/xloadimage.man Fri Mar 2 19:02:11 1990
- ***************
- *** 324,339 ****
- .fi
- .PP
- Other contributing people include Barry Shein (bzs@std.com), Kirk L.
- ! Johnson (tuna@athena.mit.edu), Mark Snitilly (zok!mark@apple.com), and
- W. David Higgins (wdh@mkt.csd.harris.com).
- .SH FILES
- .nf
- .in +5
- ! xloadimage - the image loader and viewer
- ! xsetbg - pseudonym which quietly sets the background
- ! xview - pseudonym which views in a window
- ! /usr/lib/xloadimagerc - default system-wide configuration file
- ! ~/.xloadimagerc - user's personal configuration file
- .in -5
- .fi
- .SH COPYRIGHT
- --- 324,339 ----
- .fi
- .PP
- Other contributing people include Barry Shein (bzs@std.com), Kirk L.
- ! Johnson (tuna@athena.mit.edu), Mark Snitily (zok!mark@apple.com), and
- W. David Higgins (wdh@mkt.csd.harris.com).
- .SH FILES
- .nf
- .in +5
- ! xloadimage - the image loader and viewer
- ! xsetbg - pseudonym which quietly sets the background
- ! xview - pseudonym which views in a window
- ! /usr/lib/X11/Xloadimage - default system-wide configuration file
- ! \~/.xloadimagerc - user's personal configuration file
- .in -5
- .fi
- .SH COPYRIGHT
- ***************
- *** 370,380 ****
- You cannot load an image onto the root window if the default visual is
- not supported by \fIxloadimage\fR.
- .PP
- ! If color images with substantially differing colormaps are loaded onto
- ! the root window, eventually there will be no more sharable colors in
- ! the default colormap and subsequent image loads onto the root window
- ! will fail. This is the result of limitations within X and a lack of
- ! any protocol for handling root window and/or default colormap changes.
- .PP
- One of the pseudonyms for \fIxloadimage\fR, \fIxview\fR, is the same
- name as Sun uses for their SunView-under-X package. This will be
- --- 370,381 ----
- You cannot load an image onto the root window if the default visual is
- not supported by \fIxloadimage\fR.
- .PP
- ! Images loaded onto the root window are retained with
- ! XSetCloseDownMode(disp, RetainTemporary) so that they can be easily
- ! cleaned out by future image loads. Any application that does an
- ! XKillClient(disp, AllTemporary) will free up the root colormap (and
- ! things will get ugly). Likewise, xloadimage will free up resources
- ! which other applications have retained via RetainTemporary.
- .PP
- One of the pseudonyms for \fIxloadimage\fR, \fIxview\fR, is the same
- name as Sun uses for their SunView-under-X package. This will be
- ***************
- *** 382,391 ****
- XView.
- .PP
- Some window managers do not correctly handle window size requests. In
- ! particular, versions of the twm window manager prior to X11R4 will use
- the MaxSize hint instead of the PSize hint, causing images which
- are larger than the screen to display in a window larger than the
- ! screen, something which is normally avoided. These versions of twm
- also ignore the MaxSize argument's real function, to limit the maximum
- size of the window, and allow the window to be resized larger than the
- image. If this happens, \fIxloadimage\fR merely places the image in
- --- 383,392 ----
- XView.
- .PP
- Some window managers do not correctly handle window size requests. In
- ! particular, many versions of the twm window manager use
- the MaxSize hint instead of the PSize hint, causing images which
- are larger than the screen to display in a window larger than the
- ! screen, something which is normally avoided. Some versions of twm
- also ignore the MaxSize argument's real function, to limit the maximum
- size of the window, and allow the window to be resized larger than the
- image. If this happens, \fIxloadimage\fR merely places the image in
- diff -c xloadimage.03/zoom.c xloadimage.04/zoom.c
- *** xloadimage.03/zoom.c Wed Dec 6 15:21:20 1989
- --- xloadimage.04/zoom.c Fri Mar 2 19:02:12 1990
- ***************
- *** 57,83 ****
- if (!xzoom && !yzoom) /* stupid user */
- return(NULL);
-
- ! if (verbose) {
- ! if (!xzoom) {
- printf(" Zooming image Y axis by %d%%...", yzoom);
- sprintf(buf, "%s (Y zoom %d%%)", oimage->title, yzoom);
- ! }
- ! else if (!yzoom) {
- printf(" Zooming image X axis by %d%%...", xzoom);
- ! sprintf(buf, "%s (X zoom %d%%)", oimage->title, xzoom);
- ! }
- ! else if (xzoom == yzoom) {
- printf(" Zooming image by %d%%...", xzoom);
- ! sprintf(buf, "%s (%d%% zoom)", oimage->title, xzoom);
- ! }
- ! else {
- printf(" Zooming image X axis by %d%% and Y axix by %d%%...",
- xzoom, yzoom);
- ! sprintf(buf, "%s (X zoom %d%% Y zoom %d%%)", oimage->title,
- ! xzoom, yzoom);
- ! }
- ! fflush(stdout);
- }
-
- xindex= buildIndex(oimage->width, xzoom, &xwidth);
- yindex= buildIndex(oimage->height, yzoom, &ywidth);
- --- 57,86 ----
- if (!xzoom && !yzoom) /* stupid user */
- return(NULL);
-
- ! if (!xzoom) {
- ! if (verbose)
- printf(" Zooming image Y axis by %d%%...", yzoom);
- sprintf(buf, "%s (Y zoom %d%%)", oimage->title, yzoom);
- ! }
- ! else if (!yzoom) {
- ! if (verbose)
- printf(" Zooming image X axis by %d%%...", xzoom);
- ! sprintf(buf, "%s (X zoom %d%%)", oimage->title, xzoom);
- ! }
- ! else if (xzoom == yzoom) {
- ! if (verbose)
- printf(" Zooming image by %d%%...", xzoom);
- ! sprintf(buf, "%s (%d%% zoom)", oimage->title, xzoom);
- ! }
- ! else {
- ! if (verbose)
- printf(" Zooming image X axis by %d%% and Y axix by %d%%...",
- xzoom, yzoom);
- ! sprintf(buf, "%s (X zoom %d%% Y zoom %d%%)", oimage->title,
- ! xzoom, yzoom);
- }
- + if (verbose)
- + fflush(stdout);
-
- xindex= buildIndex(oimage->width, xzoom, &xwidth);
- yindex= buildIndex(oimage->height, yzoom, &ywidth);
- dan
- -----------------------------------------------------------
- O'Reilly && Associates
- argv@sun.com / argv@ora.com
- 632 Petaluma Ave, Sebastopol, CA 95472
- 800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104
- Opinions expressed reflect those of the author only.
-